#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2018/5/6 10:33
# @Author  : zx
# @Site    : 
# @File    : model.py
# @Software: PyCharm

from flaskdemo import db


class User(db.Model):
    __tablename__ = "user"

    id = db.Column(db.Integer(), primary_key=True)
    username = db.Column(db.String(255))
    password = db.Column(db.String(255))

    # def __init__(self, username):
    #     #     self.username = username

    def __repr__(self):
        return "<User '{}'>".format(self.username)



class Category(db.Model):
    __tablename__ = 'b_category'
    id = db.Column(db.Integer,primary_key=True)
    title = db.Column(db.String(20),unique=True)
    content = db.Column(db.String(100))

    def __init__(self,title,content):
        self.title = title
        self.content = content
    def __repr__(self):
        return '<Category %r>' % self.title